<?php
$s = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_bind($s, '127.0.0.1', '8000');
socket_listen($s, 5);
socket_set_block($s);
socket_set_option($s, SOL_SOCKET, SO_RCVTIMEO, array("sec"=>1, "usec"=>0));
socket_accept($s);
